<!DOCTYPE html>
<html lang="en">

<head>
    <title>加华教育订课系统</title>
    <#include "/jh/app/components/meta.html" />
    <#include "/jh/app/components/stylesheets.html" />
    <link rel="stylesheet" href="/jh/app/stylesheets/index.css?v=1">

    <!-- 圣诞主题 -->
    <link rel="stylesheet" href="/jh/app/stylesheets/ChristmasIndex.css">
    
</head>

<body>
    <div id="app" class="weather snow">


        <div class="Xmas-flower1 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54e1.png" alt="">
        </div>
        <div class="Xmas-flower11 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54e1.png" alt="">
        </div>
        <div class="Xmas-flower12 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54e1.png" alt="">
        </div>
        <div class="Xmas-flower13 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54e1.png" alt="">
        </div>


        <div class="Xmas-flower2 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54f1.png" alt="">
        </div>
        <div class="Xmas-flower21 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54f1.png" alt="">
        </div>
        <div class="Xmas-flower22 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54f1.png" alt="">
        </div>
        <div class="Xmas-flower23 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da54f1.png" alt="">
        </div>


        <div class="Xmas-flower3 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower31 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower32 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower33 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower34 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower35 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower36 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>
        <div class="Xmas-flower37 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da612c.png" alt="">
        </div>


        <div class="Xmas-flower4 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da59c2.png" alt="">
        </div>
        <div class="Xmas-flower41 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da59c2.png" alt="">
        </div>
        
        <div class="Xmas-flower42 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da59c2.png" alt="">
        </div>
        <div class="Xmas-flower43 flower">
            <img src="https://i.loli.net/2018/12/17/5c177f8da59c2.png" alt="">
        </div>






        <div class="logo">        
            <!-- 圣诞主题 -->
            <img src="https://i.loli.net/2018/12/17/5c177f8da8a3e.png" class="am-img-responsive" />

        </div>
        <div class="login-form">
            <div class="login-form-field">
                <div class="login-form-field-icon"> 
                    <!-- 圣诞主题 -->
                    <img src="https://i.loli.net/2018/12/17/5c177f8da8029.png" class="am-img-responsive" />

                </div>
                <div class="login-form-field-input">
                    <input type="text" v-model="account" placeholder="用户名 / 手机号" />
                </div>
            </div>
            <div class="login-form-field">
                <div class="login-form-field-icon">
                    <!-- 圣诞主题 -->
                    <img src="https://i.loli.net/2018/12/17/5c177f8da5ae2.png" class="am-img-responsive" />

                </div>
                <div class="login-form-field-input">
                    <input type="password" v-model="password" placeholder="密码" />
                </div>
            </div>
            <div class="login-form-submit">
                <button class="am-btn theme-background-color1" @click="login">登录</button>
            </div>
            <footer style="font-size: 1rem; padding: 1.6rem 1rem 0px; text-align: center; left: 0px; width: 100%;"><p>由 <a href="http://www.zhen-yee.com/" title="蓁奕科技" target="_blank" style="color: rgb(14, 144, 210);">蓁奕科技</a> 提供技术支持 CopyRight©2018 Zhenyi Tech Inc.</p></footer>
        </div>
        <div class="backgroundImg">
            <img src="https://i.loli.net/2018/12/17/5c177f8dab900.png" alt="bg">
        </div>
        
    </div>
    <#include "/jh/app/components/scripts.html" />

    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js"></script>
    <script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data() {
            return {
                account: '',
                password: ''
            }
        },
        mounted: function() {},
        methods: {
            login() {
                loading();
                var self = this;
                var encoded = self.aesCBC(self.password);
                var param = Qs.stringify({
                    account: self.account,
                    password: encoded
                });
                axios({
                    url: '/jh/app/login',
                    method: 'post',
                    data: param,
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                .then(function(response) {
                    if (response.data.status == 200) {
                        endLoading();
                        var state = "${state!''}"
                        if (state != '') {
                            window.location.href = state;   
                        }else{
                            window.location.href = "/jh/app/list";   
                        }
                        // msg("登录成功");
                    } else {
                        endLoading();
                        msg("登录失败：" + response.data.msg);
                        console.log(response.data);
                    }
                })
                .catch(function(error) {
                    endLoading();
                    msg("登录失败");
                    console.log(error);
                });
            },
            aesCBC(text) {
                var aesText = text;
                var key = CryptoJS.enc.Utf8.parse('${key!}');
                var iv = CryptoJS.enc.Utf8.parse('RandomInitVector');
                aesText = CryptoJS.AES.encrypt(text, key, {
                    iv: iv,
                    mode: CryptoJS.mode.CBC,
                    padding: CryptoJS.pad.Pkcs7
                }).toString();
                return aesText;
            }
        }
    })
    </script>
    <script>
    // wx.ready(function() {
    //     initWXShare()
    // })
    </script>
</body>

</html>